package com.systop.service.impl;

import com.systop.mapper.AdminMapper;
import com.systop.pojo.Admin;
import com.systop.service.AdminSevice;
import com.systop.unti.ResponseResult;
import org.apache.ibatis.annotations.Select;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @Author zhangnan
 * @Data 2020/7/028 上午 11:04
 * @Descriiption
 **/
@Service
@Transactional
public class AdminServiceImpl implements AdminSevice {
    @Autowired
    private AdminMapper adminMapper;
    //管理员登陆
    @Override
    public ResponseResult login(String admin_name,String admin_password) {
        Admin admin = adminMapper.login(admin_name,admin_password);
        if (admin!=null){
            return ResponseResult.ok(admin);
        }else {
            return ResponseResult.build(400, "错误");
        }

    }
    //管理员注册
    @Override
    public ResponseResult loginin(String admin_name,String admin_password) {
        Integer i = adminMapper.loginin(admin_name,admin_password);
        if (i!=null){
            return ResponseResult.ok(i);
        }else {
            return ResponseResult.build(400, "错误");
        }
    }
}
